<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/blog/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="从实践的角度给出一些沉浸式状态栏的方法，并解决沉浸式带来的问题 本文适用于4.4到更高的系统版本  实现的效果  状态栏透明">
<meta property="og:type" content="article">
<meta property="og:title" content="沉浸式状态栏简单实现">
<meta property="og:url" content="http://yoursite.com/2018/07/17/statusBar/index.html">
<meta property="og:site_name" content="二松同学">
<meta property="og:description" content="从实践的角度给出一些沉浸式状态栏的方法，并解决沉浸式带来的问题 本文适用于4.4到更高的系统版本  实现的效果  状态栏透明">
<meta property="og:image" content="https://raw.githubusercontent.com/songsongtao/learngit/master/%E6%95%88%E6%9E%9C1.png">
<meta property="og:image" content="https://raw.githubusercontent.com/songsongtao/learngit/master/%E6%95%88%E6%9E%9C2.png">
<meta property="article:published_time" content="2018-07-17T05:43:45.000Z">
<meta property="article:modified_time" content="2020-06-23T03:08:32.950Z">
<meta property="article:author" content="二松">
<meta property="article:tag" content="android">
<meta property="article:tag" content="状态栏">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://raw.githubusercontent.com/songsongtao/learngit/master/%E6%95%88%E6%9E%9C1.png">

<link rel="canonical" href="http://yoursite.com/2018/07/17/statusBar/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-Hans'
  };
</script>

  <title>沉浸式状态栏简单实现 | 二松同学</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/blog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">二松同学</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">拥有梦想只是一种智力，实现梦想才是一种能力</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/blog/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/blog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/07/17/statusBar/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.jpg">
      <meta itemprop="name" content="二松">
      <meta itemprop="description" content="good good study day day up.">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="二松同学">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          沉浸式状态栏简单实现
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2018-07-17 13:43:45" itemprop="dateCreated datePublished" datetime="2018-07-17T13:43:45+08:00">2018-07-17</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-06-23 11:08:32" itemprop="dateModified" datetime="2020-06-23T11:08:32+08:00">2020-06-23</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/%E6%8A%80%E6%9C%AF%E5%8D%9A%E5%AE%A2/" itemprop="url" rel="index"><span itemprop="name">技术博客</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <blockquote>
<p>从实践的角度给出一些沉浸式状态栏的方法，并解决沉浸式带来的问题</p>
<p>本文适用于4.4到更高的系统版本</p>
</blockquote>
<h3 id="实现的效果"><a href="#实现的效果" class="headerlink" title="实现的效果"></a>实现的效果</h3><p><img src="https://raw.githubusercontent.com/songsongtao/learngit/master/%E6%95%88%E6%9E%9C1.png" alt="效果1"></p>
<p><img src="https://raw.githubusercontent.com/songsongtao/learngit/master/%E6%95%88%E6%9E%9C2.png" alt="效果2"></p>
<h3 id="状态栏透明"><a href="#状态栏透明" class="headerlink" title="状态栏透明"></a>状态栏透明</h3><ol>
<li><p>使用代码设置</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 使状态栏透明 android 5.0以上</span></span><br><span class="line"><span class="comment"> * 获取根布局给其添加内容延伸到状态栏标记，并设置状态栏透明色</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line">  <span class="meta">@TargetApi</span>(Build.VERSION_CODES.LOLLIPOP)</span><br><span class="line">  <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">transparentStatusBar</span><span class="params">(Activity activity)</span> </span>&#123;</span><br><span class="line">      View decorView = activity.getWindow().getDecorView();</span><br><span class="line">      <span class="keyword">int</span> option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN</span><br><span class="line">              | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;</span><br><span class="line">      decorView.setSystemUiVisibility(option);</span><br><span class="line">      activity.getWindow().setStatusBarColor(Color.TRANSPARENT);</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>修改<code>app</code>主题文件</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- app主题 --&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">style</span> <span class="attr">name</span>=<span class="string">"AppTheme"</span> <span class="attr">parent</span>=<span class="string">"Theme.AppCompat.Light.NoActionBar"</span>&gt;</span></span><br><span class="line"><span class="xml">     <span class="comment">&lt;!-- Customize your theme here. --&gt;</span></span></span><br><span class="line"><span class="xml">     <span class="tag">&lt;<span class="name">item</span> <span class="attr">name</span>=<span class="string">"colorPrimary"</span>&gt;</span>@color/colorPrimary<span class="tag">&lt;/<span class="name">item</span>&gt;</span></span></span><br><span class="line"><span class="xml">     <span class="tag">&lt;<span class="name">item</span> <span class="attr">name</span>=<span class="string">"colorPrimaryDark"</span>&gt;</span>@color/colorPrimaryDark<span class="tag">&lt;/<span class="name">item</span>&gt;</span></span></span><br><span class="line"><span class="xml">     <span class="tag">&lt;<span class="name">item</span> <span class="attr">name</span>=<span class="string">"colorAccent"</span>&gt;</span>@color/colorAccent<span class="tag">&lt;/<span class="name">item</span>&gt;</span></span></span><br><span class="line"><span class="xml">  	<span class="comment">&lt;!-- 状态栏透明 --&gt;</span></span></span><br><span class="line"><span class="xml">     <span class="tag">&lt;<span class="name">item</span> <span class="attr">name</span>=<span class="string">"android:windowTranslucentStatus"</span>&gt;</span>true<span class="tag">&lt;/<span class="name">item</span>&gt;</span></span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>

</li>
</ol>
<h3 id="状态栏字体颜色"><a href="#状态栏字体颜色" class="headerlink" title="状态栏字体颜色"></a>状态栏字体颜色</h3><blockquote>
<p>实现图一效果，因为安卓碎片化的原因要分情况处理</p>
</blockquote>
<ul>
<li><p><code>android6.0</code>以上版本,支持深色模式，可以让状态的文字和图片变成黑色（默认状态栏文字和图片为白色）</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) &#123;            					   	       activity.getWindow().getDecorView()</span><br><span class="line">    .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><code>android6.0</code>以下版本根据品牌系统适配</p>
<ol>
<li><p>小米</p>
<blockquote>
<p>具体可以查看小米开放平台的开发文档</p>
</blockquote>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">if</span> (Build.MANUFACTURER.equals(<span class="string">"Xiaomi"</span>)) &#123;</span><br><span class="line">	Class&lt;? extends Window&gt; clazz = activity.getWindow().getClass();</span><br><span class="line">	<span class="keyword">try</span> &#123;</span><br><span class="line">		<span class="keyword">int</span> darkModeFlag = <span class="number">0</span>;</span><br><span class="line">		Class&lt;?&gt; layoutParams = 			Class.forName(<span class="string">"android.view.MiuiWindowManager$LayoutParams"</span>);</span><br><span class="line">		Field field = layoutParams.getField(<span class="string">"EXTRA_FLAG_STATUS_BAR_DARK_MODE"</span>);</span><br><span class="line">		darkModeFlag = field.getInt(layoutParams);</span><br><span class="line">		Method extraFlagField = clazz.getMethod(<span class="string">"setExtraFlags"</span>, <span class="keyword">int</span><span class="class">.<span class="keyword">class</span>, <span class="title">int</span>.<span class="title">class</span>)</span>;</span><br><span class="line">		extraFlagField.invoke(activity.getWindow(), darkModeFlag, darkModeFlag);</span><br><span class="line">		&#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>魅族</p>
<blockquote>
<p>魅族系统貌似会自动根据界面的背景自己适配状态栏颜色</p>
</blockquote>
</li>
<li><p>其他</p>
<p>可以去查看对应系统的开发文档</p>
</li>
</ol>
<h3 id="半透明状态栏"><a href="#半透明状态栏" class="headerlink" title="半透明状态栏"></a>半透明状态栏</h3><blockquote>
<p>如果<code>UI</code>妹子不是特别要求透明状态栏的话，可以使用该方式（图2效果）</p>
<p>其实就是给布局的顶部加一个状态栏大小高度一样的半透明控件</p>
</blockquote>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//设置半透明状态栏</span></span><br><span class="line">    <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">setHalfStatusBar</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="comment">//获取状态工具类</span></span><br><span class="line">        <span class="keyword">int</span> statusBarHeight = StatusBarUtil.getStatusBarHeight(<span class="keyword">this</span>);</span><br><span class="line">        <span class="keyword">if</span> (statusBarHeight &gt; <span class="number">0</span>) &#123;</span><br><span class="line">            <span class="comment">//给根布局加一个和状态栏一样大小高度半透明黑色的状态栏，并放置在顶部</span></span><br><span class="line">            ViewGroup content = (ViewGroup) findViewById(android.R.id.content);</span><br><span class="line">            View translucentStatusBarView = StatusBarUtil.createTranslucentStatusBarView(<span class="keyword">this</span>, <span class="number">56</span>);</span><br><span class="line">            <span class="keyword">if</span> (translucentStatusBarView != <span class="keyword">null</span>) &#123;</span><br><span class="line">                content.addView(translucentStatusBarView);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 获取状态栏高度</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> context context</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 状态栏高度</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">int</span> <span class="title">getStatusBarHeight</span><span class="params">(Context context)</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 获得状态栏高度</span></span><br><span class="line">        <span class="keyword">int</span> resourceId = context.getResources().getIdentifier(<span class="string">"status_bar_height"</span>, <span class="string">"dimen"</span>, <span class="string">"android"</span>);</span><br><span class="line">        <span class="keyword">int</span> dimensionPixelSize = context.getResources().getDimensionPixelSize(resourceId);</span><br><span class="line">        <span class="keyword">if</span> (dimensionPixelSize &lt;= <span class="number">0</span>) &#123; <span class="comment">// 如果为获取不到 就使用xml文件的</span></span><br><span class="line">            dimensionPixelSize = context.getResources().getDimensionPixelSize(R.dimen.top_bar);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> dimensionPixelSize;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 创建半透明矩形 View</span></span><br><span class="line"><span class="comment">     * 注意是LinearLayout.LayoutParams，因为默认添加到decorView</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> alpha 透明值</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 半透明 View</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> View <span class="title">createTranslucentStatusBarView</span><span class="params">(Activity activity, <span class="keyword">int</span> alpha)</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 绘制一个和状态栏一样高的矩形</span></span><br><span class="line">        View statusBarView = <span class="keyword">new</span> View(activity);</span><br><span class="line">        LinearLayout.LayoutParams params =</span><br><span class="line">                <span class="keyword">new</span> LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));</span><br><span class="line">        statusBarView.setLayoutParams(params);</span><br><span class="line">        statusBarView.setBackgroundColor(Color.argb(alpha, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>));</span><br><span class="line">        <span class="keyword">return</span> statusBarView;</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<h3 id="带来的问题"><a href="#带来的问题" class="headerlink" title="带来的问题"></a>带来的问题</h3><ul>
<li><p>布局时会加上状态栏的高度</p>
<p>解决1：给布局或者第一个控件加上一个状态栏高度的<code>padding</code>或<code>margin</code></p>
<p>解决2：<code>fitSystemWindows</code>调整系统窗口布局以适应你自定义的布局 </p>
</li>
<li><p><code>fitSystemWindows</code>带来的输入法问题</p>
<p>​    当给布局加上该属性后，布局会自动添加一个padding让布局的内容在状态栏之下，但是会导致输入弹出遮挡控件或者设置了<code>fitSystemWindows</code>属性的控件被拉伸。</p>
<p>​    大家可以参考网上的办法解决</p>
<p>​    </p>
</li>
</ul>
</li>
</ul>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/blog/tags/android/" rel="tag"># android</a>
              <a href="/blog/tags/%E7%8A%B6%E6%80%81%E6%A0%8F/" rel="tag"># 状态栏</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/blog/2018/04/11/NoShiftBottomNavigationView/" rel="prev" title="BottomNavigationView解决三个限制记录">
      <i class="fa fa-chevron-left"></i> BottomNavigationView解决三个限制记录
    </a></div>
      <div class="post-nav-item">
    <a href="/blog/2020/06/22/%E5%B8%B8%E7%94%A8hexo%E5%91%BD%E4%BB%A4/" rel="next" title="常用hexo命令">
      常用hexo命令 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#实现的效果"><span class="nav-number">1.</span> <span class="nav-text">实现的效果</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#状态栏透明"><span class="nav-number">2.</span> <span class="nav-text">状态栏透明</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#状态栏字体颜色"><span class="nav-number">3.</span> <span class="nav-text">状态栏字体颜色</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#半透明状态栏"><span class="nav-number">4.</span> <span class="nav-text">半透明状态栏</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#带来的问题"><span class="nav-number">5.</span> <span class="nav-text">带来的问题</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="二松"
      src="/blog/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">二松</p>
  <div class="site-description" itemprop="description">good good study day day up.</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">27</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/blog/tags/">
          
        <span class="site-state-item-count">32</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">二松</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>




  













<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'forest',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  

</body>
</html>
